<?php
//---------------------------------------------------------------------------------------
// Author  : BugTraker
// File    : connection.php - connect/disconnect to database.
// Date    : 08/01/2010 23:58
// Website : http://www.bugtraker.pl 
//
// SAC (Simple Add Comment) - Copyright (C) 2009 BugTraker (http://www.bugtraker.pl).
//
// SAC is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// BeFree is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with BeFree; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//---------------------------------------------------------------------------------------


//---------------------------------------------------------------------------------------
// Open database connection.
//
// Arguments:
// N/A
// 
// Return:
// N/A
//---------------------------------------------------------------------------------------
function sac_connection_open()
{
  $connection = @mysql_connect(SAC_SERVER, SAC_LOGIN, SAC_PASS);

  if ($connection)
    {
      $db_connection = @mysql_select_db(SAC_DBASE, $connection) or die("No db selected!");  
    }
  else
    {
      mysql_close();
      echo "MySQL connection failed.";
    }
}  


//---------------------------------------------------------------------------------------
// Close database connection.
//
// Arguments:
// N/A
// 
// Return:
// N/A
//---------------------------------------------------------------------------------------
function sac_connection_close()
{
  mysql_close();
}

php?>
